package com.tripwego.client.ui;

import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class DialogAttenteWidget extends DialogBox {

	public static final String MESSAGE_CHARGEMENT = "Chargement en cours...";

	public static final String MESSAGE_ENREGISTREMENT = "Enregistrement en cours...";
	
	public static final String MESSAGE_SUPPRESSION = "Suppression en cours...";

	private static DialogAttenteWidget instance;

	private Label lbl_message = new Label(MESSAGE_CHARGEMENT);

	private VerticalPanel contentPanel = new VerticalPanel();

	public static DialogAttenteWidget getInstance() {
		if (null == instance) { // Premier appel
			instance = new DialogAttenteWidget();
		}
		return instance;
	}

	private DialogAttenteWidget() {
		removeStyleDependentName("gwt-DialogBox");
		removeStyleName("gwt-DialogBox");

		setModal(true);

		setWidget(contentPanel);
		contentPanel.setStyleName("popup_chargement");

		lbl_message.setWordWrap(false);

		contentPanel.add(lbl_message);

		hide();
	}

	public void initMessage(String message) {
		lbl_message.setText(message);
		center();
	}

}
